package com.imay.live.adapter;

import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.imay.live.model.UnreadModel;
import com.imay.live.R;

import java.util.List;

import static com.imay.live.manager.MessageManager.NewWarnType.IMBubbleCommentType;
import static com.imay.live.manager.MessageManager.NewWarnType.IMBubbleFollowType;
import static com.imay.live.manager.MessageManager.NewWarnType.IMBubbleGiftType;
import static com.imay.live.manager.MessageManager.NewWarnType.IMBubbleMindType;
import static com.imay.live.manager.MessageManager.NewWarnType.IMBubblePraiseType;
import static com.imay.live.manager.MessageManager.NewWarnType.IMBubbleRePostType;
import static com.imay.live.manager.UnreadManager.TYPE_UNREAD_MESSAGE;

/**
 * Created by Administrator on 2017/5/27.
 */

public class NoticeBubbleAdapter extends BaseQuickAdapter<UnreadModel,BaseViewHolder> {

    public NoticeBubbleAdapter(@Nullable List<UnreadModel> data) {
        super(R.layout.item_notice_bubble,data);
    }

    @Override
    protected void convert(BaseViewHolder helper, UnreadModel item) {
        helper.setText(R.id.tv_notice_bubble,"+"+item.getValue());
        helper.setBackgroundRes(R.id.iv_notice_bubble,getIcon(item.getWarnType()));

    }
    private int getIcon(int type){
        int imageId=0;
        switch (type){
            case IMBubbleCommentType:
                imageId = R.mipmap.ico_04tz_pinlun;
                break;
            case IMBubbleMindType:
                imageId = R.mipmap.ico_04tz_aite;
                break;
            case IMBubbleGiftType:
                imageId = R.mipmap.ico_04tz_liwu;
                break;
            case IMBubbleRePostType:
                imageId = R.mipmap.ico_04tz_fenxiang;
                break;
            case IMBubblePraiseType:
                imageId = R.mipmap.ico_04tz_aixin;
                break;
            case IMBubbleFollowType:
                imageId = R.mipmap.ico_04tz_tianjiahaoyou;
                break;
            case TYPE_UNREAD_MESSAGE:
                imageId = R.mipmap.ico_04tz_sixin;
                break;
        }
        return imageId;
    }

}
